package Demo2;

class NameException extends RuntimeException{
    public NameException() {
        super();
    }
    public NameException(String s) {
        super(s);
    }
}
class PassWordException extends RuntimeException{
    public PassWordException () {
        super();
    }
    public PassWordException(String s) {
        super(s);
    }
}
class Login{
    private String name;
    private String password;

    public Login(String name, String password) {
        this.name = name;
        this.password = password;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
    public void login(String name,String PassWord)throws NameException,PassWordException{
        if(!this.name.equals(name)){
            throw new NameException();
        }
        if(this.password.equals(password)){
            throw new PassWordException("密码错误");
        }
    }
}
public class Test {

    public static void main(String[] args) {
        Login login=new Login("abc","123");
        try {
            login.login("111","111");
        }catch (NameException e){
            e.printStackTrace();
        }catch (PassWordException e){
            e.printStackTrace();
        }

        System.out.println("llll");
    }
}
